﻿using Core.Info;
using Serilog.Core;
using Serilog.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Core.Log.SerilogExtend.Enricher
{
    /// <summary>
    /// 应用信息增强
    /// </summary>
    public class AppInfoEnricher : ILogEventEnricher
    {
        public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
        {
            logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty(
                    "AppInfo", 
                    new { 
                        应用名称 = AppInfo.AppTitle,
                        应用版本号 = AppInfo.Version,                        
                    }));
        }
    }
}
